package com.hrzyit.whistle.cases.presenter

import com.hrzyit.base.ext.execute
import com.hrzyit.base.presenter.BasePresenter
import com.hrzyit.base.rx.BaseObserver
import com.hrzyit.whistle.cases.data.bean.SelectUserDeptInfoVo
import com.hrzyit.whistle.cases.presenter.view.SelectDeptUserForApproveView
import com.hrzyit.whistle.cases.service.ICaseCenterService
import javax.inject.Inject

/**
 * 批示接收人-单位 Presenter
 * @author YangWei
 * @date 2019/4/20
 */
class SelectDeptUserForApprovePresenter @Inject constructor() : BasePresenter<SelectDeptUserForApproveView>() {

    @Inject
    lateinit var caseCenterService: ICaseCenterService


    /**
     * 获取批示接收单位/人员列表
     * @author YangWei
     * @date 2019/4/29
     * @param caseId   案件id
     * @param userId   操作人id
     * @return 批示接收单位/人员列表 @{link SelectUserDeptInfoVo}
     */
    fun selectDeptUserForApproveList(caseId: Long, userId: Long) {
        if (!checkNetWork()) {
            return
        }

        // 显示进度框
        mView.showLoading()

        caseCenterService.getDeptUserForApproveList(caseId, userId)
            .execute(object : BaseObserver<MutableList<SelectUserDeptInfoVo>>(mView) {
                override fun onNext(t: MutableList<SelectUserDeptInfoVo>) {
                    mView.onGetSelectDeptUserForApproveListSuccess(t)
                }
            }, lifecycleProvider)
    }
//
//    /**
//     * 保存案件派遣人(处置人)信息
//     * @author YangWei
//     * @date 2019/4/20
//     * @param caseId   案件id
//     * @param userId   操作人id
//     * @param disposeDeptId   处置单位id
//     * @param disposeUserId   处置人id
//     * @return 成功(true)|失败(false)
//     */
//    fun saveCaseDisposeUser(caseId: Long, userId: Long, disposeDeptId: Long, disposeUserId: Long) {
//        if (!checkNetWork()) {
//            return
//        }
//
//        // 显示进度框
//        mView.showLoading()
//
//        caseCenterService.saveCaseDisposeUser(caseId, userId, disposeDeptId, disposeUserId)
//            .execute(object : BaseObserver<Boolean>(mView) {
//                override fun onNext(t: Boolean) {
//                    mView.onSaveCaseDisposeUserSuccess(t)
//                }
//            }, lifecycleProvider)
//    }

}